<?php 
use_helper('Pagination');    
if(!isset($hide))
	$hide = array();
?>

<script type="text/javascript">
function refresh(page, orderField){
	if(!page) page = 1;
	if(!orderField) orderField = '';
	document.getElementById('updateView').style.display = 'block';
	var ancienClassName = document.getElementById('items_list').className;
	document.getElementById('items_list').className = ancienClassName + ' working';
	var xhr = getXmlHttpRequest2();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200)
			{
			textResponse = xhr.responseText;
			document.getElementById('updateView').style.display = 'none';
			document.getElementById('items_list').className = ancienClassName;
			//document.getElementById('listeDemandes').style.opacity = 1;
			document.getElementById('items_list').innerHTML = textResponse;
		}
	};
	xhr.open("POST","<?php print url_for($module.'/renderList'); ?>",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.setRequestHeader('X_REQUESTED_WITH','XMLHttpRequest');
	xhr.send("page="+page+"&order="+orderField+"&className=<?php echo $objDef->className;?>&view=<?php echo $view?>");		
}
</script>

<?php if($objDef->indexExtraTemplate!=''){
		include_partial($objDef->indexExtraTemplate, array('objDef' => $objDef)); 
	}?>
<h1><?php echo __('List of ') . $objDef->labelPlural?></h1>
<?php if($sf_user->getAttribute('current_app')=='touch'):?>
<a href="<?php echo url_for('@userHome')?>">
<button class="button_b" style="width:200px; float: right;">
	<img alt="" src="/images/icons/48/back.png"><br/>
		Retour
</button></a>
<div style="clear:both"></div>
<?php endif;?>
<?php include_partial('search/searchBar',array( 'className' => $objDef->className, 'moduleRef' => $module, 'actionRef' => 'index', 'ajaxSearch'=>true))?>

	<div id="updateView" style="display:none;text-align:center;">
	<img alt="<?php echo __('wait please...')?> '" src="/images/ajax-loader.gif">
	</div>
	<div id="items_list"></div>

<script type="text/javascript">
	
	$(document).ready(function() 
	{
		addFilters();
	});	
</script>	